#ifndef UDPSOCKET_H
#define UDPSOCKET_H
#include <QUdpSocket>
#include <QByteArray>
#include <QObject>

#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>


typedef struct socketMessages
{
    QHostAddress sender;
    quint16 senderPort;
    QByteArray datagram;
    socketMessages()
    {
        sender = "127.0.0.1";
        senderPort = 1234;
    }
}AccessMessages, *pAccessMessages;

class udpsocket: public QUdpSocket
{
    Q_OBJECT
public:
    explicit udpsocket(const int& part,QObject *parent = nullptr);
    ~udpsocket();
    void sendMessage( QByteArray datagram );

private:
    static udpsocket * m_pInstance;
    int    UDP_PORT;
signals:
    void retUdpMessage(void *p);

private slots:
    void processPendingDatagrams();


};

#endif // UDPSOCKET_H
